<template>
  <div>
    <div style="padding-right: 20px; padding-top: 20px">
      <el-form label-width="100px">
        <el-form-item label="表单名称">
          <el-input placeholder="请输入字段名称" @blur="configChange" v-model="formDefinition.showName"/>
        </el-form-item>

        <el-form-item label="数据表名">
          <template v-slot:label>
            <el-popover
              placement="top-start"
              title="开发人员专用"
              :width="200"
              trigger="hover">
              <template #reference>
                数据库表
              </template>
            </el-popover>
          </template>
          <el-input placeholder="请输入字段名称" @blur="configChange" v-model="formDefinition.tableName"/>
        </el-form-item>

        <el-form-item label="formName">
          <template v-slot:label>
            <el-popover
                placement="top-start"
                title="开发人员专用"
                :width="200"
                trigger="hover">
              <template #reference>
                formName
              </template>
            </el-popover>
          </template>
          <el-input placeholder="请输入字段名称" @blur="configChange" v-model="formDefinition.formName"/>
        </el-form-item>
      </el-form>
    </div>
    <FSection title="视图属性">
      <div style="margin-top: 15px">
        <el-form label-width="100px">
          <el-form-item label="视图宽度">
            <el-input-number placeholder="请输入视图宽度" @blur="configChange" @change="configChange"
                             v-model="designView.width" :step="10" :min="560" :max="1900"/>
          </el-form-item>
        </el-form>
      </div>
    </FSection>
    <FSection title="视图块显示控制">

    </FSection>
  </div>
</template>

<script>
import {DefaultFormDefinition, DefaultViewDefinition} from '@/components/form/DefaultFormDefinition';
import FSection from '@/components/FSection';
export default {
  name: 'FormConfiguraion',
  components: {
    FSection
  },
  props: {
    designView: {
      type: Object,
      default: () => JSON.parse(JSON.stringify(DefaultViewDefinition))
    },
    formDefinition: {
      type: Object,
      default: () => JSON.parse(JSON.stringify(DefaultFormDefinition))
    }
  },
  data() {
    return {
      viewTab: 'view',
    };
  },
  methods: {
    configChange() {
      if (!this.formDefinition.formName || this.formDefinition.formName === '') this.formDefinition.formName = '表单名称';
      this.$emit('formConfigChange');
    },
  }
};
</script>
